import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';

export default (appInfo: EggAppInfo) => {
  const config = {} as PowerPartial<EggAppConfig>;
  // 关闭csrf postman可用
  config.security = {
    csrf: {
      enable: false,
    },
  };
  // override config from framework / plugin
  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1672313286522_5876';

  // add your egg config in here
  config.middleware = [];

  config.validate = {
    convert: true,
    widelyUndefined:true
  };
  
  config.mongoose = {
    client: {
      url: 'mongodb://127.0.0.1:27017/dev',
      options: undefined,
    },
  };
  
  config.redis = {
    client: {
      port: 6479,
      host: "192.168.100.52",
      password: "",
      db: 0
    }
  }
  // add your special config in here
  const bizConfig = {
    sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
  };

  // the return config will combines to EggAppConfig
  return {
    ...config,
    ...bizConfig,
  };
};
